#!/usr/bin/env python
#coding=utf-8
from bs4 import BeautifulSoup

import urllib2
def download(url, user_agent='wswp', num_retries=2):
	print 'Downloading:', url
	headers = {'User-agent':user_agent}
	request = urllib2.Request(url, headers=headers)
	try:
		html = urllib2.urlopen(request).read()
		#print html
	except urllib2.URLError as e:
		print('Download error:', e.reason)
		html = None
		if num_retries > 0:
			if hasattr(e, 'code') and 500 <= e.code < 600:
				#retyr 5XX HTTP errors
				return download(url, user_agent, num_retries-1)
	return html

url = 'http://example.webscraping.com/places/default/view/Cuba-55'
v = download(url)
soup = BeautifulSoup(v , "html.parser")
tr = soup.find(attrs={'id':'places_population__row'})
td = tr.find(attrs={'class':'w2p_fw'})
area = td.text
print area